package cn.iocoder.yudao.module.ai.dal.mysql.componentrepository;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.ai.dal.dataobject.componentrepository.ComponentRepositoryDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.ai.controller.admin.componentrepository.vo.*;

/**
 * 组件库 Mapper
 *
 */
@Mapper
public interface ComponentRepositoryMapper extends BaseMapperX<ComponentRepositoryDO> {

    default PageResult<ComponentRepositoryDO> selectPage(ComponentRepositoryPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ComponentRepositoryDO>()
                .likeIfPresent(ComponentRepositoryDO::getImgChinessName, reqVO.getImgChinessName())
                .likeIfPresent(ComponentRepositoryDO::getImgName, reqVO.getImgName())
                .eqIfPresent(ComponentRepositoryDO::getTag, reqVO.getTag())
                .eqIfPresent(ComponentRepositoryDO::getDescription, reqVO.getDescription())
                .eqIfPresent(ComponentRepositoryDO::getZipSize, reqVO.getZipSize())
                .betweenIfPresent(ComponentRepositoryDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(ComponentRepositoryDO::getZipPath, reqVO.getZipPath())
                .eqIfPresent(ComponentRepositoryDO::getRunImgType, reqVO.getRunImgType())
                .orderByDesc(ComponentRepositoryDO::getId));
    }

}